import request from '@/utils/request'
import config from '../config'

export default {
  /**
   * @description: 上传文件 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  fileUpload (params) {
    const url = "socialized-ftp/file/upload"
    return request.post(url, params)
  },
  /**
   * @description: 下载文件 *代表必填
   * @param {integer} fileId *
   * @return {Object}
   */
  fileDownload (params) {
    const url = "socialized-ftp/file/download"
    return request.get(url, params, { responseType: 'blob' })
  },
  /**
 * @description: 文件上传并返回HTTP地址 *代表必填
 * @param {integer} file *
 * @return {Object}
 */
  getUploadUrl (params, config) {
    const url = "socialized-ftp/file/getUploadUrl"
    if (config) {
      return request.post(url, params, config)
    } else {
      return request.post(url, params)
    }
  },
}
